-- town1 - "Maldon"

function autoexec()
  if (get_progress(P_SPIDER) > 0) then
    set_mtile("sign1", 000)
    set_zone("sign1", 255) 
    set_mtile("sign2", 000) 
    set_zone("sign2", 255) 
  end
  if (get_progress(P_SPIDER) == 3) then
    set_ent_active(33,0)
  end

  return
end

function refresh()
end

function postexec()
end

function zone_handler(zn)
  if (zn == 1) then
    change_map("land","mal_exit");

  elseif (zn == 2) then
    thought(HERO1," The plaque below the statue reads:",
    "Sir Maldy the Baldy, founder of the town of Maldon. ");

  elseif (zn == 3) then
    thought(HERO1," There is nothing in this pot. ");

  elseif (zn == 4) then
    bubble(HERO1,"EEEK!!!!! Theres a spider in there!!!");

  elseif (zn == 5) then
    thought(HERO1," This rain barrel oddly, is filled with rain. ");

  elseif (zn == 7) then
    touch_fire(get_pidx(0));

  elseif (zn == 8) then
    door_in("inn_in");

  elseif (zn == 9) then
    door_out("inn_exit");

  elseif (zn == 10) then
    inn("The Fuzzy Ferret Inn",25,9);

  elseif (zn == 11) then
    thought(HERO1," The sign reads:",
    "Citizens of Maldon, Beware. Just West of this establisment, is a large colony of ferocious spiders. A lesser Spiderast has even been seen nearby. The guard outside is for your protection. A reward of 200 gold is offered for the head of the spiderast.");

  elseif (zn == 12) then
    thought(HERO1, "Its locked");

  elseif (zn == 13) then
    chest(2,I_SALVE,1);

  elseif (zn == 14) then
    touch_fire(get_pidx(0));

  elseif (zn == 15) then
    thought(HERO1,"I don't have time for books now");

  elseif (zn == 16) then
    thought(HERO1,"You drink a glass of ale");
    bubble(HERO1,"Ahhh... That was good...  BELCH!");

  elseif (zn == 17) then
    door_in("rx_in");

  elseif (zn == 18) then
    door_out("rx_exit")

  elseif (zn == 19) then
    shop(4);

  elseif (zn == 20) then
    book_talk(get_pidx(0));

  elseif (zn == 21) then
    thought(HERO1,"You rummage through the junk, and only find junk.");

  elseif (zn == 22) then
    --door_in(189,13,182,4,196,15);
    door_in("armor_in");

  elseif (zn == 23) then
    door_out(48,57)

  elseif (zn == 24) then
    if (get_treasure(3) == 0) then 
      msg("Inside the chest you find a cap.",255,0);
      msg("You quickly sneak it into your pack.",255,0);
      chest(3,I_CAP1,1);
    else
      thought(HERO1,"It's empty.");
    end

  elseif (zn == 25) then
    shop(0);

  elseif (zn == 26) then
   door_in("barracks_in");

  elseif (zn == 27) then
    door_out("barracks_exit");

  elseif (zn == 28) then
    if (get_progress(P_CHORES) == 2) then
     -- if (get_progress(P_BXRUDE) == 0) then
        bubble(30, "Would you be interested in joining the mighty Royal Army of Akanthos.")
        bubble(HERO1, "Yes I would.")
        bubble(30, "Hmm, now let me see...")
        msg("The man leans over and looks upon you like a vulture to its prey.", 255, 0)
        bubble(30, "Now... Are you the son of the town taylor?")
        bubble(HERO1, "Umm... yeah")
        bubble(HERO1, "What does that have to do with...")
        bubble(30, "Everything my boy.")
        bubble(30, "I am afraid we have nothing for you here.")
        bubble(HERO1, "but.. why?")
        wait(50)
        bubble(30, "Get out of my sight kid.")
        thought(HERO1, "This must have to do with my father. Mother will know why.")
        set_progress(P_CHORES,3)
     -- else
       -- bubble(255,"Move on Now.")
      --end
    elseif (get_progress(P_CHORES) == 3) then
      bubble(30,"Move on now.")
    
    else
      bubble(30,"This is the Barracks for the Governor's battalion of the Royal Army of Akanthos.")
    end  

  elseif (zn == 29) then
    shop(1);

  elseif (zn == 30) then
    bubble(255,"You are not invited to enter the barracks living quarters.");
    set_ent_speed(HERO1, 4)
    set_ent_script(HERO1, "D2");
    wait_for_entity(HERO1, HERO1)
    --warp("bx2_up",8);

  elseif (zn == 31) then

  elseif (zn == 32) then
    warp("bxbs_dn",8); 
   --view_range(1,190,25,211,38);
   -- warp(209,29,8);

  elseif (zn == 33) then

  elseif (zn == 34) then
    warp("bx2_dn",8);
    --view_range(1,161,44,182,58);
    --warp(162,49,8);

  elseif (zn == 35) then

  elseif (zn == 36) then

  elseif (zn == 37) then

  elseif (zn == 38) then

  elseif (zn == 39) then

  elseif (zn == 40) then
    warp("bx_up",8);
    --view_range(1,161,44,182,58);
    --warp(181,49,8);

  elseif (zn == 41) then

  elseif (zn == 42) then

  elseif (zn == 43) then
    thought(HERO1,"Locked and guarded I see");
       
  elseif (zn == 44) then
    --door_in(227,37,217,25,238,39);
    door_in("library_enter");

  elseif (zn == 45) then

  elseif (zn == 46) then
    if (get_progress(P_BOOK) == 2) then
      thought(HERO1,"Maybe I didnt catch something last time, I will read through it again.")
      thought(HERO1,"Two hundred and thirty five years after the creation of Diduma, disaster struck.  The ancient and little known Kingdom of Krayiet invaded the Kingdom of Akanthos. Although rivals, Diduma rushed to the aid of Akanthos. Only to run right into their trap.  When our armies reached Akanthos' capital, the army of Krayiet had fled pillaging as they went South West. The King of Akanthos advised the King of Diduma to split his forces to go against Krayiet. But as soon as the majority of our Army went to fight them, the King of Akanthos struck coldheartedly. The army noble army of Diduma was slaughtered, and our beloved King was captured where he remains to this day.")
    else
      thought(HERO1,"This is a booktable which is currently empty.")
    end

  elseif (zn == 47) then

  elseif (zn == 48) then
    if (get_progress(P_BOOK) == 1) then
      set_progress(P_BOOK,2)
      bubble(HERO1,"Now let me see here...")
      bubble(HERO1,"The Powers of Blue Aspenwood... no")
      bubble(HERO1,"The Curing Powers of Figleaves... no thats not it.")
      bubble(HERO1,"Ahh here it is! Mushrooms and other Woodland Plants")
      thought(HERO1,"I think I will go find a seat and read this.")
      set_ent_script(HERO1, "D2L2D4");
      wait_for_entity(HERO1, HERO1)
      set_ent_facing(HERO1, FACE_LEFT)
      wait(25)
      wait_for_entity(HERO1, HERO1)
      set_ftile("booktable", 585)
      thought(HERO1,"Ahh lets see... Mushrooms, nightshade, dandielions... Ahh This is what I have been searching for. Cleverly hidden within the book are some pages explaining the history of the land. Two hundred and thirty five years after the creation of Diduma, disaster struck.  The ancient and little known Kingdom of Krayiet invaded the Kingdom of Akanthos. Although rivals, Diduma rushed to the aid of Akanthos. Only to run right into their trap.  When our armies reached Akanthos' capital, the army of Krayiet had fled pillaging as they went South West. The King Omerus of Akanthos, advised the King Amalric of Diduma to split his forces to go against Krayiet. But as soon as the majority of our Army went to fight them, the King of Akanthos struck coldheartedly. The noble army of Diduma was slaughtered, and our beloved King Amalric was captured where he remains to this day.")
      
    elseif (get_progress(P_BOOK)==2) then
      thought(HERO1,"The book is not here I left it on the table.")    
    else
      book_talk(get_pidx(0));  
    end
    

  elseif (zn == 49) then
    thought(HERO1, "The sign says:")
    thought(HERO1, "Welcome to the Maldon Library. Thanks largely in part to the great Governor of Maldon.  Please whisper when talking, people are reading.  Please do not reshelve books.")

  elseif (zn == 50) then

  elseif (zn == 51) then

  elseif (zn == 52) then
    warp("lib_up",8);
    --view_range(1,188,44,209,58);
    --warp(190,48,8);

  elseif (zn == 53) then
    warp("lib_dn",8);
    --view_range(1,217,25,238,39);
    --warp(218,30,8);

  elseif (zn == 54) then

  elseif (zn == 55) then

  elseif (zn == 56) then
    --door_in(233,13,226,4,240,15);
    door_in("home_enter");

  elseif (zn == 57) then


  elseif (zn == 58) then
    msg("You peer up the stairway, only to see some beds.", 255, 0);

  elseif (zn == 59) then
    thought(HERO1," A note reads:",
    "Gone doing Holy stuff");

  elseif (zn == 60) then
    --door_in(229,56,218,44,239,58)
    door_in("magic_in");

  elseif (zn == 61) then
    door_out("magic_out");

  elseif (zn == 62) then

  elseif (zn == 63) then
    touch_fire(get_pidx(0));

  elseif (zn == 64) then

  elseif (zn == 65) then
    thought(HERO1,"This door is locked");

  elseif (zn == 66) then
    shop(15);

  elseif (zn == 67) then
    shop(16);

  elseif (zn == 68) then

  elseif (zn == 69) then

  elseif (zn == 70) then
    if (get_progress(P_CHORES) == 6) or (get_progress(P_SPIDER) == 1) then
      sfx(25)
      change_map("manorx","entrance")     
    else
    thought(HERO1," I guess they don't want me to just barge right in.");
    end
 
  elseif (zn == 71) then
    thought(HERO1," This door is locked");

  elseif (zn == 72) then
    thought(HERO1," This door is locked");

  elseif (zn == 73) then

  elseif (zn == 74) then
  
  elseif (zn == 75) then
    change_map("haunt", "haunt_e")
 
  elseif (zn == 76) then
    door_out("jon_exit"); 

  elseif (zn == 77) then
    if (get_progress(P_CHORES) == 1) then
      door_in("jon_enter");
    else
      thought(HERO1,"It's securely locked.");
    end
 
  elseif (zn == 78) then
    if (get_progress(P_CHORES) == 1) then
      LOC_remove_gate()
    
    elseif (get_progress(P_CHORES) == 2) then
      LOC_lock_gate()
      
    else
      --bubble(HERO1, "its locked.");   -- do nothing
    end

  elseif (zn == 79) then
    thought(HERO1," The sign reads:",
    "Citizens of Maldon, Beware. In the the forest just West of the Inn, is a large colony of ferocious spiders. A lesser Spiderast has even been seen nearby. A reward of 200 gold is offered for the head of the spiderast.");
 
  elseif (zn == 81) then 
    if (get_progress(P_SPIDER) == 2) then
      set_progress(P_SPIDER,3)
    end

  elseif (zn == 85) then
    door_out(90,70);

 elseif (zn == 86) then
      bubble(25,"Welcome to the library.");    

  elseif (zn == 87) then    --door to outside
    door_out(44,48);

  elseif (zn == 88) then  --stairs
    --change_map("townx",270,30,270,30);
    warp("homestairs_up",8);

  elseif (zn == 89) then
    touch_fire(get_pidx(0));

  elseif (zn == 90) then
    thought(HERO1,"It only contains Mother's wares.");

  elseif (zn == 91) then
    thought(HERO1,"These drawers contain needles and thread.");

  elseif (zn == 92) then
    thought(HERO1,"This here is our oven.");

  elseif (zn == 93) then
    thought(HERO1,"Cotton, linen, silk, more fabric then I care to think about.");

  elseif (zn == 94) then
    thought(HERO1,"Here are some barrels holding some of Mother's supplies.");

  elseif (zn == 95) then
    thought(HERO1,"These crates hold some of Mother's wares.");

  elseif (zn == 96) then
---thought(HERO1,"These crates hold some of Mother's wares.");

  elseif (zn == 97) then 
    thought(HERO1,"This book shows some of the designs Mother will sew for customers.");

  elseif (zn == 98) then
    thought(HERO1,"Mother's log of her sales.")
    thought(HERO1,"Which just means work for me.")
    bubble(HERO1,"sigh...")
    wait(25)
    bubble(28,"Quit moping around and get to work.");

  elseif (zn == 99) then
    warp("homestairs_dn",8);

  elseif (zn == 100) then
    thought(HERO1,"Mother always keeps her room locked.")

  elseif (zn == 101) then
    thought(HERO1,"This is my writing desk.")

  elseif (zn == 102) then
    chest(5, 0, 173)
    thought(HERO1,"Other then the gold that was there, its all junk.") 

  elseif (zn == 103) then
    thought(HERO1,"My very own bookcase.")

  elseif (zn == 104) then
    thought(HERO1, "And this is where I put my clothes.")
  
  elseif (zn == 105) then
    thought(HERO1,"This painting is a picture of the capital of Diduma before it was controlled by Akanthos.")
    thought(HERO1,"It reminds me of what my father fought and died for...")
    
  elseif (zn == 106) then

    if (prompt(HERO1, 2, 0, "Take a nap?",
                          "  yes",
                          "  no") == 0) then
      do_inn_effects(1)
    end


--    if (prompt(HERO1,2,0,"Do you want to sleep?","  yes","  no","") == 0) then
--      for a=0,get_numchrs()-1,1 do
 --       set_party_hp(a,get_party_mhp(a));
  --      set_party_mp(a,get_party_mmp(a));
--        do_fadeout(4)
   --    do_fadein(4)
    --   end
     --  inn("My room",0,0);    

    --end 

  elseif (zn == 107) then
    if (get_progress(P_CHORES) == 1) then
      --do nothing
    
    elseif (get_progress(P_CHORES) == 2) then
      --do nothing
      
    else
      bubble(HERO1, "its locked.");   
    end

    elseif (zn == 108) then
      thought(HERO1,"A painting of the Fires of Westin. It's a depiction of a battle where Fiebraes, my father, the Mage General of Diduma called fire down upon the enemies of Diduma."); 
   
    -- Book Shelf Middle Right
    elseif (zn == 109) then --End Case
      thought(HERO1,"There is a sign at the end of this book case it reads 0-299");
    
    elseif (zn == 110) then --0-099 080 Quotes
      thought(HERO1,"There is a book here titled Favorite Quotes of The Rich and Famous.")

    elseif (zn == 111) then --0-099 098 Hoaxes
      thought(HERO1,"There is a book here titled The Best of Snopes.");

    elseif (zn == 112) then --100-199  133 Magic
      thought(HERO1,"There is a book here titled The Way of the Magician.");

    elseif (zn == 113) then --100-199  177 Ethics of social relations
      thought(HERO1,"There is a book here titled The Ethics of War.");

    elseif (zn == 114) then --200-299 Religions
      thought(HERO1,"There is a book here titled The Guardians: Truth or Legend.");

    -- Book Shelf against Back Wall
    elseif (zn == 115) then --End Case
      thought(HERO1,"There is a sign at the end of this book case it reads 300-599");

    elseif (zn == 116) then --300-399 345 Criminal Law
      thought(HERO1,"There is a book here titled Criminal Law of Akanthos.");

    elseif (zn == 117) then --300-399 395 Etiquette
      thought(HERO1,"There is a book here titled Banquet Etiquette.");

    elseif (zn == 118) then --400-499 419 Verbal language not spoken or written 
      thought(HERO1,"There is a book here titled The Language of the Areeams.");

    elseif (zn == 119) then --500-599   
 
    if (get_progress(P_PLANTLORE) == 0) then
      thought(HERO1,"There is a book here titled Plant Lore. It looks like it could be interesting.");
      thought(HERO1,"hmm ... let's see..");
      thought(HERO1,"How to recognize medicinal herbs... that would be useful.");
      msg("Corin Learned Plant Lore!", 255, 0)
      set_progress(P_PLANTLORE,1)
    else
      thought(HERO1,"Ok I will look through it again.");
    end  



    --thought(HERO1,"There is a book here titled Fish of the Great Sea.");

    -- zn 48 579 Microorganisms, fungi & algae (True History Book)

    -- Book Shelf on Middle Left
    elseif (zn == 120) then --610 Medicine Medical sciences Medicine
      thought(HERO1,"There is a spell book here on Magical Poisoning.");
      chest(30, I_B_VENOM, 1)

--    elseif (zn == 115) then --600-699 620 Engineering
--    thought(HERO1,"There is a book here titled How to Build a House.");

    elseif (zn == 121) then --600-699 630 Agriculture
      thought(HERO1,"There is a book here titled Getting the Most from Your Corn Harvest.");

    elseif (zn == 122) then --700-799 700 Arts 
      thought(HERO1,"There is a book here titled Famous Artists of the Last Century.");

    elseif (zn == 123) then --700-799 795 Games of chance 
      thought(HERO1,"There is a book here titled Gambling for Fun and Profit.");

    elseif (zn == 124) then --800-899 890 Literatures of other languages 
      thought(HERO1,"There is a book here titled The Greatest Essays of Modern Akanthos.");

    elseif (zn == 125) then --900-999 929 Genalogy
      thought(HERO1,"There is a book here titled The Genealogy of the Akanthosian Kings.");

    elseif (zn == 126) then --900-999 990 General history of other areas
      thought(HERO1,"There is a book here titled Ancient Akanthosian History.");

    elseif (zn == 127) then --End Case
      thought(HERO1,"There is a sign at the end of this book case it reads 600-999");

    elseif (zn == 128) then 
      change_map("grotto2","grotto2_enter");
    
  end
end
    
    
    

function entity_handler(en)
  if (en == 0) then
    if (get_progress(P_MALWELCOME) == 0) then
      bubble(en, "Welcome to the town of Maldon.")
      bubble(en, "This town has lots of interesting places to visit.")
      bubble(HERO1, "Um yeah I know. I live here.")
      set_progress(P_MALWELCOME,1)
    elseif (get_progress(P_MALWELCOME) == 1) then 
      bubble(en, "I get paid to welcome people here.")
    else
      bubble(en, "Hello again")  
    end

 elseif (en == 1) then
    bubble(1, "Hello there $0.");


 elseif (en == 2) then
    
    if (get_progress(P_MALSTORY) == 0) then
      bubble(2,"Hundreds of years ago...");
      bubble(2,"Excuse me I'm talking.");
      bubble(2,"The most powerful magic users of each Race ruled the world.");
      set_progress(P_MALSTORY,1)
    elseif (get_progress(P_MALSTORY) == 1) then 
      bubble(en, "There power was unmatched. Physical wounds would do them little harm, for in time there bodies would be restored completely. They ruled the world with great wisdom for generations. For these ancient sages did not seem to age.  But one by one they began to fall to darkness. They oppressively reigned there once beloved subjects. But there were those who confronted their evil. A powerful mage united a force and drove off the Guardians as they called themselves. With some unknown power they killed many of the guardians and imprisoned others. The very Gods, the Father and Mother of this world were even said to walk the streets before the fall. All holiness to them.");
      bubble(en, "Of all, they were the most displeased at the fall of the Guardians.  Such destruction they reigned down on the city of the Guardians is unheard of and little spoken of.");
      bubble(en, "This was called the Great Fall. It pains my soul to think of the lost grandeur."); 
    end


 elseif (en == 3) then
    bubble(3,"My Grandpa tells great stories.");

 elseif (en == 4) then
    bubble(4,"These are private homes. You can not enter here, without an invitation.");

  elseif (en == 5) then
    bubble(5,"These are private homes. You can not enter here, without an invitation.");

  elseif (en == 6) then
    bubble(6,"This is the manor of the Governor of Maldon and  the surrounding lands.");

  elseif (en == 7) then
    bubble(7,"I dont give tours.");

  elseif (en == 8) then
    bubble(8,"The Governor does not want any guests.");

  elseif (en == 9) then
    bubble(9,"The Governor will not welcome your intrusion.");

  elseif (en == 10) then
    bubble(10,"GET OFF THE FLOWERS!");

  elseif (en == 11) then
    bubble(11,"GET OFF THE FLOWERS!");

  elseif (en == 12) then
    bubble(12,"I like patrolling the grounds.");

  elseif (en == 13) then
    bubble(13,"That guy over there is always happy. He scares me.");

  elseif (en == 14) then
    bubble(14,"ZZZZZZZ.....");

  elseif (en == 15) then
    bubble(15,"ZZZZ... SNORT... ZZZZZZ");

  elseif (en == 16) then
    bubble(16,"ZZZZ....");

  elseif (en == 17) then
    bubble(17,"I don't like romance novels, like that other fellow.");
    bubble(17,"That's all there is here. I think there trying to pacify us.");

  elseif (en == 18) then
    bubble(18,"I love romance novels, especially the mushy parts.");

  elseif (en == 19) then
    bubble(19,"Welcome to my battalion.");

  elseif (en == 20) then
    bubble(20,"I always lose at cards.");

  elseif (en == 21) then
    bubble(21,"Do you have any 5s?");
    bubble(20,"Go Fish!");

  elseif (en == 22) then
    bubble(22,"That guard is sooo dumb.");

  elseif (en == 23) then
    bubble(23,"I guard the prisoner.");

  elseif (en == 24) then
    bubble(24,"grunt");

  elseif (en == 25) then
    
    if (get_progress(P_LIBRARIAN) == 1) then
      set_progress(P_LIBRARIAN,2)
      bubble(HERO1, "What can you tell me about the War between Diduma and Akanthos.");
      bubble(en, "Its quite a horrific story mind you. That bears quite close to home for you if I am not quite mistaken.");
      bubble(HERO1,"I want the truth.");
      bubble(en,"Very well...");
      bubble(en,"Some years ago an army from Krayiet invaded your neighbor, the land of Akanthos. We were sorely outnumbered by Krayiet's vast forces. We called for help from our rival your Kingdom, Diduma. Diduma came to our aid. Together we pushed the army of Krayiet's with hardly a fight, back to their own kingdom. Diduma's forces said they were worried about their lands and left while we pursued them to their capital. When we returned we found that your father and your King betrayed us! They ravaged our lands and murdered our people. Our King returned just in time to overthrow Diduma's army and capture your King. Your father was executed for his crimes.");
      bubble(HERO1, "How could you say that about my...");
      bubble(en, "You wanted the truth didn't you?");
      bubble(HERO1, "I uh... well... The truth will come out someday. Mark my words! And the one responsible will be sorry.");
      bubble(en, "Ahh $0 if I didn't have any hope for you I would throw you straight to the guards.");
       
    elseif (get_progress(P_LIBRARIAN) == 2) then
      bubble(HERO1, "So can you tell me your version of the war again.");
      bubble(en," Its the truth I tell you!");
      bubble(HERO1, "Get on with it.");
      bubble(en, "Some years ago an army from Krayiet invaded your neighbor, the land of Akanthos. We were sorely outnumbered by Krayiet's vast forces. We called for help from our rival your Kingdom, Diduma. Diduma came to our aid. Together we pushed the army of Krayiet's with hardly a fight, back to their own kingdom. Diduma's forces said they were worried about their lands and left while we pursued them to their capital. When we returned we found that your father and your King betrayed us! They ravaged our lands and murdered our people. Our King returned just in time to overthrow Diduma's army and capture your King. Your father was executed for his crimes.");
    else
      bubble(en, "Welcome to the library.");
    end

  elseif (en == 26) then
    bubble(26, "...Oh did you say something?");
    bubble(26, "Please, go away...I'm reading the best novel I've ever read.");

  elseif (en == 27) then
    bubble(27, "Ahh hello young $0.");
    bubble(27, "Would you like me to reccomend a book for you?");
    if (get_progress(P_DADSTORY) == 0) then
      if (prompt(27, 2, 255, "well...","  ok","  no thanks","") == 0) then
        bubble(27, "I love the romantic ballads of lore. Here is my favorite.");
        bubble(HERO1, "Thats not what I had in mind.");
        bubble(27, "Ohh... I'm sorry.");
      else
        bubble(27, "Oh ok. Why are you in the library if you dont want a book?");
      end
    elseif (get_progress(P_DADSTORY) == 1) then
      bubble(HERO1, "My mother said there would be information here about the war and...");
      bubble(HERO1, "and about my father.");
      bubble(en, "Quiet boy! The Governor's men are always around.");
      bubble(en, "You will get your self in trouble talking like that. The Head Librarian for instance is sworn to the Governor. Do not bother yourself with talking to him. His version of events are quite different.");
      bubble(HERO1, "So you don't know anything then...");
      bubble(en, "I did not say that $0.");
      bubble(en, "Directly below where we are standing is the plant section.");
      bubble(en, "The book you want is disguised with a title that says:");
      bubble(en, "Mushrooms and other Woodland Plants");
      bubble(HERO1, "Umm thanks I think.");
      set_progress(P_DADSTORY,2)
      set_progress(P_LIBRARIAN,1)
      set_progress(P_BOOK,1)

    else 
     bubble(HERO1, "Can you tell me anything else?")
     bubble(HERO1, "Quiet boy, that's all I can say about it.")    
    end

  elseif (en == 28) then
     if (get_progress(P_CHORES) == 0) then
       bubble(en, "Ahh $0 I was wondering where you had gone off to.")
       bubble(HERO1, "Just around.")
       bubble(en, "Well I need you to do a few things for me.")
       bubble(en, "Johnathan of Ahln ordered a travelling cloak.")
       bubble(en, "You will deliver it for me.")
       bubble(HERO1, "Uh.. who?")
       bubble(en, "Its really simple just go due east from here.")
       bubble(en, "His is the first house once you have gone through the gate.")
       bubble(en, "His house has a rain barrel next to it if you get lost.")
       sfx(5) 
       msg("Travelling cloak procured", 255, 0)
  
       set_progress(P_CHORES,1)

    
     elseif (get_progress(P_CHORES) == 1) then
       bubble(en,"Now get going now and deliver the cloak.")
 
     elseif (get_progress(P_CHORES) == 2) then
       --if (get_progress(P_BXRUDE) == 1) then
        -- bubble(en,"Your dad was a warhero.")
       --else
       bubble(en, "Oh good thank you.") 
       bubble(en, "That Johnanthan is a filthy scoundrel from Akanthos.")
       bubble(en, "But gold is gold no matter where it comes from...")
         
     elseif (get_progress(P_CHORES) == 3) then    
       bubble(HERO1, "Why would father's role in the war cause me to be rejected for the King's army?")
       msg("Your mother glares at you with an affronted look.",255,0)
       bubble(en, "How could you even dare consider joining the enemy!")
       bubble(HERO1, "To find out more about them!")
       bubble(HERO1, "To find out their weaknesses.") 
       bubble(en, "There are other ways $0.")
       bubble(en, "But never by joining those maggots!")
       bubble(HERO1, "You never answered my question. What does this have to do with father.")
       bubble(en, "Now $0 You are being quite foolish.")
       bubble(en, "Its because your honorable Father was the Mage General for Diduma's Royal Army.")
       bubble(en, "Those who know your lineage, view you as a threat, $0.")
       bubble(en, "So keep your head down or you will get yourself killed.")
       bubble(en, "We must act at the right time.")
       bubble(HERO1, "... do what?")
       bubble(en, "Thats enough now, $0")
       set_progress(P_CHORES,4)
  
    elseif (get_progress(P_CHORES) == 4) then
      set_progress(P_DADSTORY,1)
      set_progress(P_CHORES,5)  
      bubble(en,"Quit bothering me about the war.")
      bubble(en,"If you want to know more go check the library.")
  
    elseif (get_progress(P_CHORES) == 5) then
      if (get_progress(P_DADSTORY) == 2) then
        bubble(en, "I have one more chore for you $0 and then you will be free for a while.")
        bubble(en, "I need you to deliver to that horrible traitorous Governor a new set of robes for him and and a dress for his daughter.")
        bubble(en, "His mansion is north of here you can't miss it.")
        sfx(5) 
        msg("Governor's Clothes procured.", 255, 0)
        set_progress(P_CHORES,6) 
      else
        bubble(en, "If you want to know more go check the library. The old lady upstairs is a friend of mine. She might know something.")
      end
    
    elseif (get_progress(P_CHORES) == 6) then
      bubble(en, "How difficult is it for you to go and deliver clothes to the governor?")
  
    elseif (get_progress(P_CHORES) == 7) then
      if (get_progress(P_GIRL) < 3) then -- or (get_progress(P_GIRL) == 1) then
        bubble(en, "I have another chore for you. And before you say anything don't worry it will be the last one.");
        bubble(en, "I would like you to take this scroll to my friend, Madam Marigold. Remember she lives just south of here in a clearing in the woods.");
        bubble(HERO1,"Yes mother.");
        bubble(en, "Now $0 you had better be careful in those woods there are wolves and worse inside. And $0 you should at least have some armor. You should still have some gold upstairs if you haven't already spent it all.");
        bubble(HERO1,"I know mother.");
      else
        bubble(HERO1,"I got the message to her.");
        bubble(en,"Oh thank you $0");
        bubble(en, "Sensar stopped by. He was looking for you. He said he had something important to tell you. He said he would meet you at the usual place. Whatever that means. Probably just off in the woods somewhere. He muttered something about a pond.")
        bubble(HERO1,"Thanks mother.")
        set_progress(P_CHORES,8)
      end

    elseif (get_progress(P_CHORES) == 8) then 
      bubble(en, "Can't you see I'm busy. I have too much to do. Go off somewhere and give me some peace.")
        	 
    end
   
  elseif (en == 29) then 
   if (get_progress(P_CHORES) == 1) then
     bubble(HERO1, "Hello Johnathan. I am $0 son of the taylor.")
     bubble(HERO1, "Here is the cloak you requested.")
     msg("You hand over the Travelling cloak", 255, 0)
     bubble(en, "Ahh thank you my boy.")
     bubble(en, "Here is some gold for your troubles.")
     set_gp(get_gp() + 5)
     sfx(6)
     msg("Johnathan gives you 5 gold.")
     thought(HERO1, "Ahh gee thanks.")
     bubble(en, "Have a good day.")
     set_progress(P_CHORES,2)
     move_entity(HERO1, "cor_walk")
     wait_for_entity(HERO1, HERO1)
     bubble(en, "When I was your age I joined the army.")
     set_ent_facing(HERO1, FACE_UP)
     wait_for_entity(HERO1, HERO1)
     bubble(HERO1, "Uh.. Ok.")
     bubble(en, "Discipline.")
     bubble(en, "Young folks these days just don't have any.")
     bubble(en, "You should go and check it out.")
     bubble(en, "You can join at the barracks. The big building with swords on the front.")
     bubble(HERO1, "Thanks for the advice.")

   else
     bubble(en,"Now go on boy.")
   
   end
    
  elseif (en == 30) then 
    --rude guy in the barracks behind the desk

  elseif (en == 31) then  
    bubble(en,"Hello. How are you today?");
    bubble(HERO1,"I'm doing well.");

  elseif (en == 32) then  
    bubble(en,"I can't talk now I have so many things to do.");

  elseif (en == 33) then   
    if (get_progress(P_SPIDER) == 0) then 
      bubble(en,"I am here to protect the Inn from spiderasts. There is a colony somewhere in the woods just West of here.");
    else  
      bubble(HERO1,"It's done. The Spidrerast is dead.");
      bubble(en,"That's welcome news. Go to the Governor's place for your reward.");
    end
    

  end--elseif

end--function

function LOC_remove_gate()
  -- Get rid of the gate doors
  local y
  local x, a = marker("gate")
  for y = a - 1, a + 1, 1 do
    set_zone(x - 1, y, 0)
    set_obs(x - 1, y, 0)
  end
end

function LOC_lock_gate()
  -- locks the gate doors
  local y
  local x, a = marker("gate")
  for y = a - 1, a + 1, 1 do
    set_zone(x - 1, y, 1)
    set_obs(x - 1, y, 1)
  end
end

